<template>
  <div
    @click="handleChange"
    v-if="showFullScreenBtn"
    class="full-screen-wrapper"
  >
    <el-tooltip
      :content="value ? 'exist full screen' : 'full screen'"
      placement="bottom"
    >
      <el-button
          link
      >
        <el-icon><FullScreen /></el-icon>
      </el-button>

    </el-tooltip>
  </div>
</template>

<script>
import screenfull from 'screenfull'

export default {
  name: 'TheFullScreen',
  props: {
    value: {
      type: Boolean,
      default: false,
    },
  },
  computed: {
    showFullScreenBtn() {
      return window.navigator.userAgent.indexOf('MSIE') < 0
    },
  },
  methods: {
    handleChange() {
      screenfull.toggle()
    },
  },
}
</script>

<style lang="less">
@import '../../../style/common/variable';
.full-screen-wrapper {
  display: inline-block;
  width: 30px;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  color: @color-white;
  i {
    font-size: 23px;
  }
}
</style>
